home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / which213.zip / src-org / which.doc < prev    next >
Text File  |  1993-07-28  |  5KB  |  114 lines

  1.  
  2. WHICH(1)                 USER COMMANDS                   WHICH(1)
  3.  
  4. NAME
  5.      which - locate commands and data files, and print paths
  6.  
  7. SYNOPSIS
  8.      which [ -a ] [ -l | -d ] command [ command ... ]
  9.  
  10. ARGUMENTS
  11.      command  Command or list of commands (or files) to locate.
  12.  
  13. OPTIONS
  14.      -a  list all matches, not just first one
  15.      -l  search LIBPATH for DLLs
  16.      -d  search DPATH for data files
  17.  
  18. DESCRIPTION
  19.      By default which checks,  in  order,  command-shell  aliases
  20.      (4DOS  and  4OS2 only), internal command-shell commands, the
  21.      current directory, and directories specified in  the  user's
  22.      PATH variable for the commands given as its arguments.  If a
  23.      given command is found, its full path is printed;  otherwise
  24.      a ``not found'' message is printed with a list of the direc-
  25.      tories which were checked.  In the case the  command  is  an
  26.      internal  shell command, a message to this effect is printed
  27.      in lieu of a path.
  28.  
  29.      which respects the shell precedence of  command  extensions;
  30.      thus  more.com  is  listed  instead of more.exe, should both
  31.      exist in the same directory.  Likewise, .exe files have pre-
  32.      cedence  over .cmd files, and .cmd files over .bat files.  A
  33.      command with a dot in  its  name  has  precedence  over  any
  34.      default  extension;  for  example,  list.old is found before
  35.      list.old.exe.
  36.  
  37.      The -a option causes which to list all matching commands  in
  38.      the  path, not just the one which would be executed.  The -d
  39.      and -l options alter the nature of the search;  when  -d  is
  40.      specified,  which searches directories in the DPATH for data
  41.      files, and when -l is specified,  it  searches  through  the
  42.      LIBPATH  for  dynamic link libraries (.DLLs).  The -d and -l
  43.      options are  mutually  exclusive,  and  in  both  cases  the
  44.      current directory is searched only if ``.'' is listed in the
  45.      appropriate path.
  46.  
  47. EXAMPLES
  48.      To find the locations of five commands:
  49.  
  50.           which dir pushd format unzip zipinfo
  51.  
  52.      The output might look something like the following:
  53.  
  54.           dir:  4OS2.EXE internal command
  55.           pushd:  aliased to "c:\utils\16\pushd.cmd"
  56.           c:\os2\format.com
  57.           c:\utils\32\unzip.exe
  58.           no zipinfo in c:\os2 . c:\utils\32 c:\utils\16
  59.             c:\utils\bnd c:\os2\system c:\emx\bin
  60.             c:\groff\bin c:\os2\mdos\winos2 c:\os2\install
  61.             c:\ c:\os2\mdos c:\os2\apps c:\ibmtk\os2bin
  62.             c:\ibmwf\bin c:\ibmc\bin
  63.  
  64.      To locate all copies of the  emx.dll  dynamic  link  library
  65.      (the  first  one listed is the one which will be used by the
  66.      operating system):
  67.  
  68.           which -al emx
  69.  
  70.      To find two of the IBM Redbooks (.inf format):
  71.  
  72.           which -d gg243732 gg243774
  73.  
  74. SEE ALSO
  75.      csh(1)
  76.  
  77. BUGS
  78.      For CMD.EXE and COMMAND.COM, the list of internal shell com-
  79.      mands  is  static  and  does not reflect differences between
  80.      various versions of the command shell.  The current  command
  81.      lists correspond roughly to OS/2 2.0 and MS-DOS 5.0.
  82.  
  83.      MS-DOS 5.0 and 6.0 DOSKEY aliases (``macros'') are  not  yet
  84.      detected, because there's no good way to do so without writ-
  85.      ing a temporary file.
  86.  
  87.      There is no reasonable way to determine  the  LIBPATH  in  a
  88.      foolproof  manner; it does not have a corresponding environ-
  89.      ment variable or system call.  which looks in the config.sys
  90.      system  file  for  LIBPATH, but this can fail if the LIBPATH
  91.      line has been edited since the system was last  booted.   In
  92.      addition,  under  OS/2  1.x there is no way to determine the
  93.      boot drive, so which  may  fail  even  to  find  the  proper
  94.      config.sys.   The  16-bit (or bound) executable first checks
  95.      for \config.sys on the current drive and then on  drive  c:,
  96.      but  this  will  fail if, for example, the system was booted
  97.      from floppy drive a: and the current drive is c:.   The  32-
  98.      bit  executable  can  determine  the boot drive but is still
  99.      susceptible to editing changes and the possible  removal  of
  100.      the boot floppy.
  101.  
  102.      The list of ``proper'' extensions  for  use  with  DPATH  is
  103.      somewhat  hazy;  the  following  are  presently used:  .boo,
  104.      .dat, .hlp, .inf, .ini, .msg and .ndx.
  105.  
  106. AUTHOR
  107.      Greg Roelofs (also known as Cave Newt).   The  makefile  was
  108.      liberally borrowed from Kai Uwe Rommel's UnZip makefile.os2.
  109.      Michael Lawler and Kenneth Porter contributed code as  noted
  110.      in the source file.
  111.  
  112. Newtware                                         28 Jul 93 (v2.1)
  113.  
  114.